﻿using System;
using System.Reflection;
using MugenMvvmToolkit.Interfaces;

namespace MugenMvvmToolkitTest.TestInfrastructure
{
    public class TestDisplayNameProvider : IDisplayNameProvider
    {
        #region Properties

        public MemberInfo Member { get; set; }

        public Func<MemberInfo, string> GetNameDelegate { get; set; }

        #endregion

        #region Implementation of IDisplayNameProvider

        /// <summary>
        ///     Gets a display name for the specified type using the specified member.
        /// </summary>
        /// <param name="memberInfo">The specified member.</param>
        /// <returns>
        ///     An instance of string.
        /// </returns>
        string IDisplayNameProvider.GetDisplayName(MemberInfo memberInfo)
        {
            Member = memberInfo;
            if (GetNameDelegate == null)
                return memberInfo.Name;
            return GetNameDelegate(memberInfo);
        }

        #endregion
    }
}